﻿
@page "/Wms/OtherOutWarehouseDetail/BatchEdit"
@using nERP.ViewModel.Wms.OtherOutWarehouseDetailVMs
@using System.ComponentModel.DataAnnotations
@inherits BasePage

<ValidateForm @ref="vform" Model="@Model" OnValidSubmit="@Submit">
  <div style="margin-bottom:10px;"> @WtmBlazor.Localizer["Sys.BatchEditConfirm"]</div>
  <Row ItemsPerRow="ItemsPerRow.Two" RowType="RowType.Normal">
    <BootstrapInput @bind-Value="@Model.LinkedVM.Seq"/>
    <Select @bind-Value="@Model.LinkedVM.OtherOutWarehouseId" Items="AllOtherOutWarehouses" Id="gce3eca1314804496836779bb8523ee6d"/>
    <Select @bind-Value="@Model.LinkedVM.WarehouseId" Items="AllWarehouses" Id="g64965a3157f8488e9d601fcdb5228301"/>
    <Select @bind-Value="@Model.LinkedVM.GoodsId" Items="AllGoodss" Id="gee9897734fad4acdae9323fbdc6d0dd2"/>
    <BootstrapInput @bind-Value="@Model.LinkedVM.GoodsName"/>
    <BootstrapInput @bind-Value="@Model.LinkedVM.GoodsSpec"/>
    <BootstrapInput @bind-Value="@Model.LinkedVM.GoodsUnit"/>
    <BootstrapInput @bind-Value="@Model.LinkedVM.OtherOutNumber"/>
    <BootstrapInput @bind-Value="@Model.LinkedVM.Remark"/>
  </Row>

  <div class="modal-footer table-modal-footer">
    <Button ButtonType="ButtonType.Submit" IsAsync="true" Text="@WtmBlazor.Localizer["Sys.Submit"]"/>
    <Button OnClick="OnClose" Text="@WtmBlazor.Localizer["Sys.Close"]"/>
  </div>

</ValidateForm>



@code {
    [Parameter]
    public string id { get; set; }
    [Parameter]
    public string[] ids { get; set; }
    private OtherOutWarehouseDetailBatchVM Model = new OtherOutWarehouseDetailBatchVM();
    private ValidateForm vform { get; set; }
    
    private async Task Submit(EditContext context)
    {
        Model.Ids = ids;
        await PostsForm(vform, "/api/Wms/OtherOutWarehouseDetail/BatchEdit", (s) => WtmBlazor.Localizer["Sys.BatchEditSuccess", s], method: HttpMethodEnum.POST);
    }
            

    public void OnClose()
    {
        CloseDialog();
    }
    
    private List<SelectedItem> AllOtherOutWarehouses = new List<SelectedItem>();
    private List<SelectedItem> AllWarehouses = new List<SelectedItem>();
    private List<SelectedItem> AllGoodss = new List<SelectedItem>();
    protected override async Task OnInitializedAsync()
    {
        
        
        AllOtherOutWarehouses = await WtmBlazor.Api.CallItemsApi("/api/Wms/OtherOutWarehouseDetail/GetOtherOutWarehouses");
        AllOtherOutWarehouses.Insert(0, new SelectedItem { Text = WtmBlazor.Localizer["Sys.PleaseSelect"],Value = "" });
        AllWarehouses = await WtmBlazor.Api.CallItemsApi("/api/Wms/OtherOutWarehouseDetail/GetWarehouses");
        AllWarehouses.Insert(0, new SelectedItem { Text = WtmBlazor.Localizer["Sys.PleaseSelect"],Value = "" });
        AllGoodss = await WtmBlazor.Api.CallItemsApi("/api/Wms/OtherOutWarehouseDetail/GetGoodss");
        AllGoodss.Insert(0, new SelectedItem { Text = WtmBlazor.Localizer["Sys.PleaseSelect"],Value = "" });

        await base.OnInitializedAsync();
    }
}
